import request from '@/utils/request'

// 获取校区信息列表(带分页)
export function getCampusList(data) {
  return request({
    url: 'api/campus',
    method: 'GET',
    data
  })
}

// 获取校区信息列表(下拉框)
export function getCampusSelector(data) {
  return request({
    url: 'api/campus/selector',
    method: 'GET',
    data
  })
}

export function getFqaEntries(ids) {
  return request({
    url: `api/extend/fqaEntries/${ids}/list`,
    method: 'GET'
  })
}
export function getCampusTrain(data) {
  return request({
    url: 'api/campus/train',
    method: 'GET',
    data
  })
}

// 获取校区信息列表(带分页)
export function getZoneList() {
  return request({
    url: '/api/jiaxiao/zone',
    method: 'GET'
  })
}

// 添加校区信息
export function createCampus(data) {
  return request({
    url: 'api/campus',
    method: 'POST',
    data
  })
}

// 获取校区信息
export function getCampusInfo(id) {
  return request({
    url: `api/campus/${id}/info`,
    method: 'GET'
  })
}

// 修改校区信息
export function updateCampus(data) {
  return request({
    url: `api/campus/${data.id}`,
    method: 'PUT',
    data
  })
}
// 修改校区信息
export function updateCampusName(data) {
  return request({
    url: `api/campus/name/${data.id}`,
    method: 'PUT',
    data
  })
}

// 修改校区状态
export function chageCampusState(data) {
  return request({
    url: `api/campus/state/${data.id}`,
    method: 'PUT',
    data
  })
}

// 删除校区信息
export function delCampus(id) {
  return request({
    url: `api/campus/${id}`,
    method: 'DELETE'
  })
}

// 获取校区合同信息列表(带分页)
export function getCampusContractList(data) {
  return request({
    url: `/api/crm/contract`,
    method: 'GET',
    data
  })
}

// 获取校区投资人列表(带分页)
export function getCampusContactList(data) {
  return request({
    url: `api/campus/contactlist`,
    method: 'GET',
    data
  })
}
// 获取校区老师信息列表
export function getCampusTeacherList(traindId, campusId) {
  return request({
    url: `/api/campus/teacher/list/${traindId}/${campusId}`,
    method: 'GET'
  })
}

/*
 * 教务辅导
 * */
export function getAcademic(data) {
  return request({
    url: `/api/campus/academic`,
    method: 'GET',
    data
  })
}
// 修改合同编号
export function updateContract(id, data) {
  return request({
    url: `api/finance/contract/${id}`,
    method: 'PUT',
    data
  })
}

// 师训列表
export function getTrainList(data) {
  let arr = Object.assign(data, { ajaxType: 'form' })
  return request({
    url: `api/campus/train/selector`,
    method: 'get',
    data: arr
  })
}

// 同步到家校平台
export function syncJiaXiao(data) {
  return request({
    url: `api/campus/async/jiaxiao/${data.id}/${data.type}`,
    method: 'post'
  })
}

// 获取校区家长平台基础数据
export function getSchoolZoneEnrollments(campusId) {
  return request({
    url: `api/campus/${campusId}/enrollments`,
    method: 'GET'
  })
}

// 获取校区参训数据
export function getCampusTrainingData(campusId) {
  return request({
    url: `api/campus/${campusId}/training-data`,
    method: 'GET'
  })
}
